package fr.fermat.databaseManager;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public  abstract class DAOBase {
	
	  protected final static int VERSION = 1;
	 
	  protected final static String NOM = "database.db";
	     
	  protected SQLiteDatabase mDb = null;
	  protected DatabaseHandler mHandler = null;
	     
	  public DAOBase(Context pContext) {
	    this.mHandler = new DatabaseHandler(pContext, NOM, null, VERSION);
	  }
	  /**
	   * create if the db dont  exist and / or Open the database   
	   * @return
	   */
	  public SQLiteDatabase open() {
	    mDb = mHandler.getWritableDatabase();
	    return mDb;
	  }
	   /**
	    * close the database  
	    */
	  public void close() {
		   mDb.close();
 
	  }
	   /**
	    * get the database
	    * @return
	    */
	  public SQLiteDatabase getDb() {
	    return mDb;
	  }
}
